home *** CD-ROM | disk | FTP | other *** search
/ Suzy B Software 2 / Suzy B Software CD-ROM 2 (1994).iso / extras / programm / gemfsc20 / gemfsc20.lzh / GEMFBIND / VDICOMN.S < prev    next >
Text File  |  1993-03-26  |  3KB  |  92 lines

  1.  
  2. ;*========================================================================
  3. ;*
  4. ;* VDIFAST Public Domain VDI bindings.
  5. ;*
  6. ;* 07/18/91 v1.6
  7. ;*            Added _vdicall entry point, to allow 'roll your own' access
  8. ;*            to the VDI.  This function takes pointers to the VDI interface
  9. ;*            arrays (control, intin, etc), which you must allocate within
  10. ;*            your own code, and fill in with the appropriate values before
  11. ;*            calling this function.    For any array which is not needed by a
  12. ;*            given VDI function, a NULL pointer may be supplied.  Also, if
  13. ;*            a NULL intout pointer is supplied, a local 256-byte intout
  14. ;*            array is allocated on the stack.  Whether a local or caller-
  15. ;*            supplied intout array is used, the _vdicall entry pointer
  16. ;*            will always return intout[0] as the function return value.
  17. ;*            For VDI functions which don't return any value(s) in intout,
  18. ;*            the return value will be whatever was in intout[0] when
  19. ;*            this function is called for caller-provided intout arrays,
  20. ;*            or consistantly zero when the internal intout array is used.
  21. ;*
  22. ;*========================================================================
  23.  
  24. ;*************************************************************************
  25. ;*
  26. ;* Common module to call VDI then return to user-program.
  27. ;*    This routine is entered via 'jmp' and does NOT return to the binding
  28. ;*    routine that calls it.
  29. ;*
  30. ;*    This is used by all bindings which return a single int from intout[0]
  31. ;*    (more specifically, from -2(a6), or which return no value.    In the
  32. ;*    latter case, we still return the word from -2(a6), but the user
  33. ;*    shouldn't care what it is.
  34. ;*
  35. ;*************************************************************************
  36.  
  37.           globl     vditrap
  38.           globl     vdicall             ; The whole world sees us.
  39.           globl     _vdicall            ; everyone sees this too.
  40.  
  41. vditrap:
  42.           moveq.l    #$73,d0
  43.           movem.l    d2/a2,-(sp)
  44.           trap        #2
  45.           movem.l    (sp)+,d2/a2
  46.           rts
  47.  
  48. vdicall:
  49.           move.l    sp,d1
  50.           bsr        vditrap
  51.           move.w    -2(a6),d0
  52.           unlk        a6
  53.           rts
  54.  
  55. ;*************************************************************************
  56. ;* _vdicall - the 'roll your own' function.
  57. ;*************************************************************************
  58.  
  59. _vdicall:
  60. ;          .cargs    #8,control.l,intin.l,ptsin.l,intout.l,ptsout.l
  61.  
  62. control   =         8
  63. intin      =         12
  64. ptsin      =         16
  65. intout      =         20
  66. ptsout      =         24
  67.  
  68.  
  69.           link        a6,#-256            ; nice big intout, 'just in case'.
  70.           move.l    a3,-(sp)            ; save this, we use it for intout.
  71.  
  72.           move.l    intout(a6),a3        ; get caller-supplied intout ptr.
  73.           move.l    a3,d0                ; test it for NULLness, if it's
  74.           bne.b     no_local_intout     ; not NULL, continue, else set
  75.           lea        -256(a6),a3         ; up a pointer to our local intout
  76.           clr.w     (a3)                ; array, and blast local intout[0].
  77.  
  78. no_local_intout:
  79.  
  80.           move.l    ptsout(a6),-(sp)    ; build vdipb on the stack...
  81.           move.l    a3,-(sp)
  82.           move.l    ptsin(a6),-(sp)
  83.           move.l    intin(a6),-(sp)
  84.           move.l    control(a6),-(sp)
  85.           move.l    sp,d1                ; load pointer to vdipb
  86.           bsr        vditrap
  87.           move.w    (a3),d0             ; return intout[0] in d0.
  88.           move.l    (sp)+,a3
  89.           unlk        a6
  90.           rts
  91.  
  92.